import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import org.springframework.util.concurrent.ListenableFuture;

@Service  
@Async  
public class AsyncService {  
  
    public void throwException() {  
        throw new RuntimeException("error");  
    }  
  
    public String asyncGet1() {  
        return "123";  
    }  
  
    //返回值必须是ListenableFuture/Future，因为是实现的问题（return ((AsyncListenableTaskExecutor) executor).submitListenable(task);）  
    public ListenableFuture<String> asyncGet2() {  
        return new AsyncResult<String>("123");  
    }  
  
}  